<?php
    $q = $_GET["q"];
    $q = 1;
    $a = mysqli_connect("localhost","root","gala123456");
    $db = mysqli_select_db($a,"sheep");
    $sql = "SELECT `sheep_url`,`sheep_class`,`sheep_birthday`,`sheep_weight` FROM `sheep` WHERE `sheepID` = '$q'";
    $query = mysqli_query($a,$sql);
    $arr = array();
    while($row = mysqli_fetch_row($query)){
        foreach ($row as $nei) {
            array_push($arr,$nei);
        }
    }
    $new_arr = array(
        "sheep_url" => explode("-",$arr[0]),
        "sheep_class" => $arr[1],
        "sheep_birthday" => $arr[2],
        "sheep_weight" => $arr[3]
    );
    echo json_encode($new_arr);
?>